/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.odichy.andfml.ui;

import org.odichy.andfml.R;
import org.odichy.andfml.content.FMLListFactory;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.widget.TabHost;

/**
 * AndFML, an FMyLife.com client on Google Android platform.
 *
 * @author Odin Liu<odinushuaia@gmail.com>
 *
 * @version 1.0.0
 */
public class TabViewActivity extends TabActivity {
	protected TabHost mTabHost;
	
	@Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.tabview);
        mTabHost = getTabHost();

        // Setup the tabs
        setupLastTab();
        setupRandomTab();
        setupTopTab();
        setupFlopTab();
        mTabHost.setCurrentTabByTag("last");
    }
	
	private void setupLastTab() {
		mTabHost.addTab(mTabHost.newTabSpec("last").setIndicator(getString(R.string.tabview_lastest),getResources().getDrawable(R.drawable.latest)).setContent(new Intent(TabViewActivity.this, LastViewActivity.class)));
	}
	
	private void setupRandomTab() {
		
	}
	
	private void setupTopTab() {
		Intent intent = new Intent(TabViewActivity.this, RankViewActivity.class);
		intent.putExtra("category", FMLListFactory.TOP);
		mTabHost.addTab(mTabHost.newTabSpec("top").setIndicator(getString(R.string.tabview_tops),getResources().getDrawable(R.drawable.top)).setContent(intent));
	}
	
	private void setupFlopTab() {
		Intent intent = new Intent(TabViewActivity.this, RankViewActivity.class);
		intent.putExtra("category", FMLListFactory.FLOP);
		mTabHost.addTab(mTabHost.newTabSpec("flop").setIndicator(getString(R.string.tabview_flops),getResources().getDrawable(R.drawable.flop)).setContent(intent));
	}
}
